<?php
// +----------------------------------------------------------------------
// | 海豚PHP框架 [ DolphinPHP ]
// +----------------------------------------------------------------------
// | 版权所有 2016~2019 广东卓锐软件有限公司 [ http://www.zrthink.com ]
// +----------------------------------------------------------------------
// | 官方网站: http://dolphinphp.com
// +----------------------------------------------------------------------

namespace app\api\home;

use app\common\controller\Api;
use think\Db;
use think\Image;
use think\File;
use think\cache\driver\Redis;
use think\db\Where;
/**
 * 订单控制器
 * @package app\index\controller
 */
// 指定允许其他域名访问
header('Access-Control-Allow-Origin:*');
// 响应类型
header('Access-Control-Allow-Methods:*');
// 响应头设置
header('Access-Control-Allow-Headers:x-requested-with,content-type');
class Tool extends Api
{

    public function index(){
        return $this->success("tbb工具接口");
    }
   
    public function upload()
    {
        $file = request()->file('file');
        if($file){
           
            // 移动到服务器的上传目录 并且使用uniqid规则
      
            $info = $file->rule('uniqid')->move('/uploads');
           // $info = $file->move(config('upload_path') . DIRECTORY_SEPARATOR . 'images');
            if($info){
                // 成功上传后 获取上传信息
                $data['file_path'] = $info->getFilename();
                $this->success('上传成功', $data);
            }else{
                // 上传失败获取错误信息
                $this->error($file->getError());
            }
        }
    }
    
    //
    public function  jiayouka(){
        set_time_limit(0);
        $header[]="Authorization:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySW5mbyI6IlYvLzFPVCsrWlVSUXlZd0RzcWc4UHRFVGdPVjZxSm5Wbzc1M1NvdU9vNFhtLzViWlhLa2w0SUJsdTZUWlBQNVJZZHQ0WEE2RytIUEZWUmwwSFlqS25BPT0iLCJleHAiOjE3MTQ3ODUzMDgsIm5iZiI6MTcxMzkyMTMwOH0.f_Rt8B3xeu6gNL7Gobo-kOjsvYORnc6gAYF5QFk_TLY";
        $header[]="content-type:application/json";
        $url="https://b2bvcard.shell.com.cn/bhz-vcs-service/apis/v1/purchases";
        $post_data=[
            "operation_type"=>"1",
            "user_id"=>"1230511859187576832",
            "pan_code"=>"51ft8dmw",
            "card_binding_mode"=>1,
            "cellphone"=>"13880446756",
            "is_reflush_qr_code"=>0,
            "auth_info"=>[
                "auth_mode"=>"password",
                "password"=>"n8wZzTUkqgLNVnDJcjNMiw==",
            ],
            "plate_number_info"=>[],
        ];
        $post_data=json_encode($post_data);
        $info=$this->postUrl($url,$post_data,$header);
        $info=json_decode($info,true);
        halt($info);
        
    }
    
    
    
    
   
    
    
    
   
    
    
}
